<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //可以让函数暂停执行，yield相当于一个暂停的标记
        //，遇到这个标记就暂停不往下执行了，除非通过next()才能往下执行
        function* gen() {
            console.log(11)
            yield //产出
            console.log(22)
            yield
            console.log(33)
        }
        let g = gen()
        g.next()
        g.next()
        g.next()
    </script>
</body>

</html>